#ifndef H_YS_MISC_
#define H_YS_MISC_

// some tiny macros and functions

typedef unsigned char	uchar;
typedef unsigned int	uint;
typedef unsigned short	ushort;

// for static_assert
template<int> struct CompileTimeError;
template<> struct CompileTimeError<true> {};
#define YS_STATIC_ASSERT(expr, msg) \
{ CompileTimeError<((expr) != 0)> ERROR_##msg; (void)ERROR_##msg; } 

// deleter
template <typename Ptr>
inline void SAFE_DEL_ARR(Ptr& p)
{
	if(p != NULL) delete []p;
	p = NULL;
}


template <typename Ptr>
inline void SAFE_DEL(Ptr& p)
{
	if(p != NULL) delete p;
	p = NULL;
}


#endif //header

